package com.link2room.rodimus.entity;

import com.link2room.common.entity.BaseEntity;
import org.hibernate.annotations.DynamicInsert;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;

/**
 * Created by VegetaKo on 2017/1/3.
 */
@DynamicInsert
@Entity
@Table(name = "mall_good_price", catalog = "")
public class MallGoodPrice extends BaseEntity {
    private String goodCode;
    private String tag;
    private String priceCode;
    private String priceType;
    private BigDecimal point;
    private BigDecimal money;

    @Basic
    @Column(name = "good_code", nullable = true, length = 16)
    public String getGoodCode() {
        return goodCode;
    }

    public void setGoodCode(String goodCode) {
        this.goodCode = goodCode;
    }
    @Basic
    @Column(name = "tag")
    public String getTag() {
        return tag;
    }

    public void setTag(String tag) {
        this.tag = tag;
    }

    @Basic
    @Column(name = "price_code", nullable = true, length = 16)
    public String getPriceCode() {
        return priceCode;
    }

    public void setPriceCode(String priceCode) {
        this.priceCode = priceCode;
    }

    @Basic
    @Column(name = "price_type", nullable = true, length = 16)
    public String getPriceType() {
        return priceType;
    }

    public void setPriceType(String priceType) {
        this.priceType = priceType;
    }

    @Basic
    @Column(name = "point", nullable = true)
    public BigDecimal getPoint() {
        return point;
    }

    public void setPoint(BigDecimal point) {
        this.point = point;
    }

    @Basic
    @Column(name = "money", nullable = true, precision = 0)
    public BigDecimal getMoney() {
        return money;
    }

    public void setMoney(BigDecimal money) {
        this.money = money;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        MallGoodPrice that = (MallGoodPrice) o;

        if (goodCode != null ? !goodCode.equals(that.goodCode) : that.goodCode != null) return false;
        if (tag != null ? !tag.equals(that.tag) : that.tag != null) return false;
        if (priceCode != null ? !priceCode.equals(that.priceCode) : that.priceCode != null) return false;
        if (priceType != null ? !priceType.equals(that.priceType) : that.priceType != null) return false;
        if (point != null ? !point.equals(that.point) : that.point != null) return false;
        return money != null ? money.equals(that.money) : that.money == null;
    }

    @Override
    public int hashCode() {
        int result = goodCode != null ? goodCode.hashCode() : 0;
        result = 31 * result + (tag != null ? tag.hashCode() : 0);
        result = 31 * result + (priceCode != null ? priceCode.hashCode() : 0);
        result = 31 * result + (priceType != null ? priceType.hashCode() : 0);
        result = 31 * result + (point != null ? point.hashCode() : 0);
        result = 31 * result + (money != null ? money.hashCode() : 0);
        return result;
    }
}
